#ifndef XX_COMMON_SIPMESSAGE_HH
#define XX_COMMON_SIPMESSAGE_HH
#include "sip_thread.h"
#include "sys_inc.h"
#include "sip.h"

class CSIPMessage
{
public:
	CSIPMessage();
	virtual ~CSIPMessage();
	virtual int SendSipMessage(void* sip, int enc_type);
	virtual int SendSipMessage(void* sip, UAEncrypt* crypt, int enc_type);

	static  void ThreadProc(void* arg);
	static  int  HandleCallback(void* sip, UAEncrypt* crypt,int flags, const char* body, int size, void* user);
public:
	virtual int OnAckReq(void* sip, UAEncrypt* crypt, const char* body, int size);
	virtual int OnByeReq(void* sip, UAEncrypt* crypt, const char* body, int size);
	virtual int OnByeRsp(void* sip, UAEncrypt* crypt, const char* body, int size, int status_code);
	virtual int OnInfoReq(void* sip, UAEncrypt* crypt, const char* body, int size);
	virtual int OnInfoRsp(void* sip, UAEncrypt* crypt, const char* body, int size, int status_code);
	virtual int OnRegistReq(void* sip, UAEncrypt* crypt, const char* body, int size);
	virtual int OnRegistRsp(void* sip, UAEncrypt* crypt, const char* body, int size, int status_code);
	virtual int OnCancelReq(void* sip, UAEncrypt* crypt, const char* body, int size);
	virtual int OnCancelRsp(void* sip, UAEncrypt* crypt, const char* body, int size, int status_code);
	virtual int OnInviteReq(void* sip, UAEncrypt* crypt, const char* body, int size);
	virtual int OnInviteRsp(void* sip, UAEncrypt* crypt, const char* body, int size, int status_code);
	virtual int OnNotifyReq(void* sip, UAEncrypt* crypt, const char* body, int size);
	virtual int OnNotifyRsp(void* sip, UAEncrypt* crypt, const char* body, int size, int status_code);
	virtual int OnMessageReq(void* sip, UAEncrypt* crypt, const char* body, int size);
	virtual int OnMessageRsp(void* sip, UAEncrypt* crypt, const char* body, int size, int status_code);
	virtual int OnSubcribeReq(void* sip, UAEncrypt* crypt, const char* body, int size);
	virtual int OnSubcribeRsp(void* sip, UAEncrypt* crypt, const char* body, int size, int status_code);
	virtual int OnRequestMessage(void* sip, UAEncrypt* crypt, const char* body, int size);
	virtual int OnResponseMessage(void* sip, UAEncrypt* crypt, const char* body, int size, int status_code);
public:
	virtual int SendTCPData(const char* data, int len);
	virtual int OpenChannel(UAContext* UContext,int iGB35114);
	virtual int SendUDPData(sockaddr_in* addr, const char* data, int len);
private:
	socket_t	mfdClient;
	void*		hSIPInit;
	int			mGB35114;

	UAEncrypt   mUAEncrypt;
	UAContext	mUAContext;

	int				  thread_exit;
	xx_thread_handle  thread_handle;
};


#endif
